/* Copyright 2011 Elektrobit Wireless Communications Oy (EB)


  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License version 2 as 
  published by the Free Software Foundation.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License along
  with this program; if not, write to the Free Software Foundation, Inc.,
  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


 *All rights reserved 
 *Version:Elektrobit_Qt_1.0.0_20110305 */


#ifndef HOMEPAGE_H
#define HOMEPAGE_H

#include <mvcframework/page.h>
#include "views/homepageview.h"
#include <libs/imagedata.h>
#include <QList>
#include <mvcframework/dbmodel.h>
#include <QGraphicsBlurEffect>


class HomePage : public Page {
    Q_OBJECT
public:
    Q_PROPERTY(QDeclarativeListProperty<ImageData> vedioDatas READ vedioDatas NOTIFY vedioDatasChanged)
    QDeclarativeListProperty<ImageData> vedioDatas();
    Q_PROPERTY(QDeclarativeListProperty<ImageData> musicDatas READ musicDatas NOTIFY musicDatasChanged)
    QDeclarativeListProperty<ImageData> musicDatas();
    Q_PROPERTY(QDeclarativeListProperty<ImageData> imageDatas READ imageDatas NOTIFY imageDatasChanged)
    QDeclarativeListProperty<ImageData> imageDatas();

    HomePage(QObject *parent = 0);
    
    int init();
    int uninit();
    int beforeShow();
    int afterShow();
    int onTouch(const QString &type, const QHash<QString, QString> *args);
    int getItemData(QString icon);
signals:
    void imageDatasChanged();
    void vedioDatasChanged();
    void musicDatasChanged();

public slots:
    int onClick(int key);
    int onIconClick(QString icon);
    int onIconEnter(QString icon);
    void onSubIconClick(int index);
    void setBlurEffect(const QString& objectName, bool enable);
private:
    void onClickButton(const QString &buttonName);
    void changeLanguage();
    void changeToFilm();
    
    QList<ImageData *>  _imageDatas;
    QList<ImageData *>  _musicDatas;
    QList<ImageData *>  _vedioDatas;
    HomePageView *mHomePageView;
    DbModel *mFilmModel;
    DbModel *mMusicModel;
    QString curCategory;
    QGraphicsBlurEffect *effect;
};
Q_DECLARE_METATYPE(HomePage);
#endif // HOMEPAGE_H
